﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

using Hangjing.Model;
using Hangjing.SQLServerDAL;
using Hangjing.Common;


public partial class AndroidAPI_GetOrderDetailByOrderId_2 : APIPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();

        string orderid = HjNetHelper.GetPostParam("orderid");
        //手机类型：0表示android,1表示ios
        int isios = 0;

        string mobileversion = Request["isios"];
        if (mobileversion != null && mobileversion == "1")
        {
            isios = 1;
        }

        Custorder dal = new Custorder();
        Foodlist orderfood_bll = new Foodlist();

        CustorderInfo info = dal.GetModel(orderid);

        StringBuilder shoplistjson = new StringBuilder();

        if (info != null)
        {
            shoplistjson.Append("{\"TotalPrice\":\"" + info.OrderSums + "\",\"UserName\":\"" + info.OrderRcver + "\",\"Tel\":\"" + info.OrderComm + "\",\"State\":\"" + info.OrderStatus.ToString() + "\",\"UserID\":\"" + info.UserId.ToString() + "\",\"foodlist\":[],");
        }
       


        shoplistjson.Append("\"TogoName\":\"" + info.TogoName + "\",\"orderTime\":\"" + info.OrderDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "\",");
        shoplistjson.Append("\"sendtype\":\"" + "0" + "\",");
        //支付部分
        shoplistjson.Append("\"PayMode\":\"" + WebUtility.TurnPayModel(info.paymode.ToString()) + "\",");
        shoplistjson.Append("\"paymoney\":\"" + info.paymoney + "\",");
        shoplistjson.Append("\"paytime\":\"" + info.paytime + "\",");
        shoplistjson.Append("\"paymodeint\":\"" + info.paymode + "\",");
        shoplistjson.Append("\"paystateint\":\"" + info.paystate + "\",");

        shoplistjson.Append("\"OrderAddress\":\"" + info.OrderAddress + "\",");
        shoplistjson.Append("\"shopauthuser\":\"" + info.shopauthuser + "\",");
        shoplistjson.Append("\"OrderAddrEx\":\"" + info.OrderAddrEx + "\",");


        shoplistjson.Append("\"cardids\":\"" + info.cardids + "\",");
        shoplistjson.Append("\"Commission\":\"" + info.Commission + "\",");
        shoplistjson.Append("\"settlecycle\":\"" + info.settlecycle + "\",");
        shoplistjson.Append("\"Advance\":\"" + info.Advance + "\",");
        shoplistjson.Append("\"Mergeorderremark\":\"" + info.Mergeorderremark + "\",");


        shoplistjson.Append("\"IsShopSet\":\"" + info.IsShopSet + "\",");
        shoplistjson.Append("\"sendstate\":\"" + info.sendstate + "\",");
        shoplistjson.Append("\"orderstateint\":\"" + info.OrderStatus + "\",");
        shoplistjson.Append("\"paystate\":\"" + WebUtility.TurnPayState(info.paystate.ToString()) + "\",");
        shoplistjson.Append("\"sitename\":\"" + "" + "\",");
        shoplistjson.Append("\"cardpay\":\"" + 0 + "\",");
        shoplistjson.Append("\"discountmsy\":\"" + "" + "\",");
        shoplistjson.Append("\"discount\":\"" + 0 + "\",");
        shoplistjson.Append("\"TogoId\":\"" + info.TogoId.ToString() + "\",\"Address\":\"" + info.AddressText + "\",\"sendmoney\":\"" + info.shopdiscountmoney + "\",\"Packagefree\":\"" + 0 + "\",\"OrderID\":\"" + info.orderid + "\",\"SentTime\":\"" + info.SendTime + "\",\"Remark\":\"" + info.OrderAttach + "\"}");

        Response.Write(shoplistjson.ToString().Replace(",],", "],"));
        Response.End();
    }
}
